package com.yiwei.ydd.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.yiwei.ydd.R;
import com.yiwei.ydd.api.model.RechargeTermDetailModel;

import butterknife.BindView;
import butterknife.ButterKnife;


/**
 * Created by xsooy-pc on 2017/10/23.
 */

public class RechargeDetailAdapter extends ItemAdapter<RechargeTermDetailModel.DatasBean, RechargeDetailAdapter.DefaultHolder> {


    public RechargeDetailAdapter(Context context) {
        super(context);
    }

    @Override
    public DefaultHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new DefaultHolder(inflate(R.layout.item_recharge_detail, parent));
    }

    @Override
    public void onBindViewHolder(DefaultHolder holder, int position) {
        RechargeTermDetailModel.DatasBean item = getItem(position);
        holder.txtTime.setText(item.get_date);
        holder.txtNum.setText(item.period);
        holder.txtMoney.setText(item.money);
    }

    class DefaultHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.txt_time)
        TextView txtTime;
        @BindView(R.id.txt_num)
        TextView txtNum;
        @BindView(R.id.txt_money)
        TextView txtMoney;

        public DefaultHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
